package IC.AST.nodes;

import IC.AST.*;

/**
 * a new array expression
 */
public class NewArrayExpr extends Expression {
	private TypeDecl elemType;	// the type of array elements
	private Expression size;	// the array size specifier

	/**
	 * @param elemType the type of array elements
	 * @param size the array size specifier
	 * @param fileName TODO
	 * @param line the node line number
	 * @param column the node column number
	 */
	public NewArrayExpr(TypeDecl elemType, Expression size, String fileName, int line, int column) {
		super(fileName, line,column);
		this.elemType = elemType;
		this.size = size;
	}

	/**
	 * @return the type of array elements
	 */
	public TypeDecl getElemType() {
		return this.elemType;
	}

	/**
	 * @return the array size specifier
	 */
	public Expression getSize() {
		return this.size;
	}

	public <D,U> U accept(PropogatingVisitor<D,U> v, D context) throws Exception {
		return v.visit(this,context);
	}
}
